package com.louis.util;

import java.util.ArrayList;
import java.util.List;

public class ListUtil {

	public static boolean isEmpty(List<?> list) {
		return (list == null || list.size() == 0);
	}

	public static <T> List<T> toList(T[] t) {
		List<T> list = new ArrayList<T>();
		if (t != null) {
			for (T t2 : t) {
				list.add(t2);
			}
		}
		return list;
	}

	public static List<String> toList(String str, String regex) {
		List<String> list = new ArrayList<String>();
		if (StringUtil.hasText(str)) {
			String[] splits = str.split(regex);
			for (String split : splits) {
				if (StringUtil.hasText(split)) {
					list.add(split.trim());
				}
			}
		}
		return list;
	}

	public static void main(String[] args) {
		int length = "na;".split(";").length;
		System.out.println(length);
	}
}
